package com.kaishengit.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.BookService;

import com.kaishengit.entity.Book;
import com.kaishengit.util.db.Page;
import com.kaishengit.util.web.ServletUtil;

public class BookManager extends HttpServlet {
	private static final long serialVersionUID = 1L;
	BookService service = new BookService();

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String page=request.getParameter("page");
		int pageInt=1;
		if(page!=null){
			pageInt=Integer.valueOf(page);
		}
		
		Page<Book> pageBook=service.selectByPage(pageInt);

		ServletUtil.setRequestAttribute(request, "pageBook", pageBook);
		ServletUtil.forward(request, response, "/admin/bookManager");
	}

}
